package org.tacademy.and12.zlistview;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class SubActivity extends Activity {

	public static final String KEY_MY_DATA = "data";
	
	TextView nameLine;
	TextView phoneLine;
	
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.subactivity_layout);
	    
	    nameLine = (TextView)findViewById(R.id.nameLine);
	    phoneLine = (TextView)findViewById(R.id.phoneLine);
	
//	    Bundle bundle = getIntent().getExtras();
//	    MyData data = (MyData)bundle.getParcelable(KEY_MY_DATA);
	    
	    Intent i = getIntent();
	    MyData data = (MyData)i.getParcelableExtra(KEY_MY_DATA);
	    
	    nameLine.setText("name : " + data.name);
	    phoneLine.setText("phone : " + data.phone);
	    
	    Button btn = (Button)findViewById(R.id.back);
	    btn.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				finish();
			}
		});
	    
	    
	    // TODO Auto-generated method stub
	}

}
